#define _CRT_SECURE_NO_WARNINGS 1


#include "SList.h"

void test1()
{
	SLTNode* plist = NULL;
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);
	SLPushFront(&plist, 5);

	SLPrint(&plist);
	SLPushBack(&plist, 6);
	SLPushBack(&plist, 7);
	SLPushBack(&plist, 8);
	SLPushBack(&plist, 9);
	SLPushBack(&plist, 10);
	SLPrint(&plist);

	SLPopBack(&plist);
	SLPopBack(&plist);
	SLPopBack(&plist);
	SLPopBack(&plist);

	SLPrint(&plist);

	SLPopFront(&plist);
	SLPopFront(&plist);

	SLPrint(&plist);
	SLDestory(&plist);

}

void test2()
{
	SLTNode* plist = NULL;
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);
	SLPushFront(&plist, 5);
	SLPrint(&plist);

	SLTNode* pos = SLFind(&plist, 5);
	if (pos)
	{
		SLInsert(&plist, pos, 30);
	}
	SLPrint(&plist);

	pos = SLFind(&plist, 1);
	if (pos)
	{
		SLInsertAfter(pos, 40);
	}
	SLPrint(&plist);
	pos = SLFind(&plist, 30);
	if (pos)
	{
		SLErase(&plist, pos);
	}
	SLPrint(&plist);

	pos = SLFind(&plist, 5);
	if (pos)
	{
		SLEraseAfter(pos);
	}
	SLPrint(&plist);
	


	SLDestory(&plist);

}

int main()
{
	//test1();
	test2();

	return 0;
}
